$(document).ready(function(){
	$('#Rebuild').bind('click', function(event) {
		var updateTarget = "#rebuild-target";
		var form =  $('#rebuild-index');
		var action = form.attr('action');
		$('h2.rebuild').fadeIn("slow");
        $.ajax({
        	url: action,
        	data: form.serialize(),
        	type: 'POST',
        	success: function(data) {
        		$('h2.rebuild').text("Finished....");
        		$(updateTarget).html(data);
        		$(updateTarget).fadeIn("slow");
        	}
        });
        return false;
	});	
});